package com.sl.au.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;

import com.sl.au.entity.BusinesssellerAuthentication;

public interface BusinesssellerAuthenticationRepository extends JpaRepository<BusinesssellerAuthentication, String>{
	
	@Query("select a from BusinesssellerAuthentication a where a.id=?1")
	BusinesssellerAuthentication getInfoById(String id);
	
	@Query("select a from BusinesssellerAuthentication a where a.businesssellerBaseInfo.id=?1")
	BusinesssellerAuthentication getInfoByBaseInfoId(String id);
	
	@Query("select a from BusinesssellerAuthentication a where (a.shopName like %?1% or a.managementPerson.name like %?1% or a.shopAdress like %?1%)  and a.infoState.title!=?2")
	Page<BusinesssellerAuthentication> getByKey(String key,String optionTitle, Pageable pageable);
	
	@Query("select a from BusinesssellerAuthentication a where a.infoState.title!=?1")
	Page<BusinesssellerAuthentication> getByCheckKey(String key, Pageable pageable);
	
}

